<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
        $this->display();
    }

    public function checkdata()
    {
    	if($res = D('user')->checkLogin(I('post.nickname'),I('post.password'))){

    		$_SESSION['aid']=$res['id'];
    		$_SESSION['nickname']=$res['nickname'];
    		$_SESSION['face']=$res['face'];

    		$arr = array(
    			'error'=>0,
    			'info'=>'登录成功'
    			);
    		echo json_encode($arr);
    		exit;
    	}else{
    		$arr = array(
    			'error'=>1,
    			'info'=>'邮箱或者密码错误'
    			);
    		echo json_encode($arr);
    		exit;
    	}

    }
}